﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ScriptEditor.Commands
{
    class Command_CameraShake : Command
    {
        public float duration
        {
            get
            {
                float result = float.TryParse(Value1, out result) ? result : 0.5f;
                return result;
            }
            set
            {
                Value1 = value.ToString();
            }
        }
        public float strength
        {
            get
            {
                return float.TryParse(Value2, out float result) ? result : 3f;
            }
            set
            {
                Value2 = value.ToString();
            }
        }
        public int vibrato  //震动次数
        {
            get
            {
                return int.TryParse(Value3, out int result) ? result : 1;
            }
            set
            {
                Value3 = value.ToString();
            }
        }
        public float randomness
        {
            get
            {
                return float.TryParse(Value4, out float result) ? result : 90f;
            }
            set
            {
                Value4 = value.ToString();
            }
        }
        public bool fadeOut
        {
            get
            {
                return bool.TryParse(Value5, out bool result) ? result : false;
            }
            set
            {
                Value5 = value.ToString();
            }
        }
        public Command_CameraShake()
        {
            CommandType = COMMANDTYPE.CameraShake;
            duration = 0.1f;
            strength = 3f;
            vibrato = 10;
            randomness = 90;
            fadeOut = false;
        }
        public Command_CameraShake(float Duration, float Strength, int Vibrato, float Randomness, bool FadeOut)
        {
            CommandType = COMMANDTYPE.CameraShake;
            duration = Duration;
            strength = Strength;
            vibrato = Vibrato;
            randomness = Randomness;
            fadeOut = FadeOut;
        }
        public override string ToString()
        {
            return CommandType.ToString() + ":\n" + "镜头震动";
        }
    }
}
